﻿// ****************************************************************************** //
//          Module for definition of Frog object and frog initial state           //
// ****************************************************************************** //

module FrogTypes

open Microsoft.Xna.Framework
open Microsoft.Xna.Framework.Input
open Microsoft.Xna.Framework.Graphics
open Utilities
open Casanova
open Coroutines
open Math
open SI
open MapGrid


[<Measure>]
type deg

type FrogState =
  {
    PositionX         : Variable<float32>
    PositionY         : Variable<float32>
    PositionZ         : Variable<float32>
    RotationY         : Variable<float32<deg>>
    mutable sphere            : BoundingSphere
    mutable VelX : float32
  }

let mutable frog_state =  //initial state
  {
    PositionX           = variable(INITIAL_X)
    PositionY           = variable(INITIAL_Y)
    PositionZ           = variable(INITIAL_Z)
    RotationY           = variable(0.0f<deg>)
    sphere = new BoundingSphere(new Vector3(INITIAL_X, INITIAL_Y, INITIAL_Z), 2.43f)
    VelX = 0.0f
  }

let reset_state () =
  frog_state <-
    {
        PositionX           = variable(INITIAL_X)
        PositionY           = variable(INITIAL_Y)
        PositionZ           = variable(INITIAL_Z)
        RotationY           = variable(0.0f<deg>)
        sphere = new BoundingSphere(new Vector3(INITIAL_X, INITIAL_Y, INITIAL_Z), 2.43f)
        VelX = 0.0f
    }


let reset_to_river () =
  frog_state <-
    {
        PositionX           = variable(INITIAL_X)
        PositionY           = variable(SIDEWALK_Y)
        PositionZ           = variable(SIDEWALK_Z)
        RotationY           = variable(0.0f<deg>)
        sphere = new BoundingSphere(new Vector3(INITIAL_X, INITIAL_Y, INITIAL_Z), 2.43f)
        VelX = 0.0f
    }





